package org.etlt.expression.function;

import java.util.ArrayList;
import java.util.List;

/**
 * system default functions for list
 *
 * @version 2.0
 */
public class ListFunctions {

    @FunctionEnabled(value = "asList", help = "get a list from the input ")
    public List<Object> asList(Object... args) {
        List<Object> result = new ArrayList<>();
        if (args.length > 0) {
            for (Object object : args)
                result.add(object);
        }
        return result;
    }

    @FunctionEnabled(value = "contains", help = "judge if en element is contained by a list, (list, an element to test) ")
    public boolean contains(List<Object> list, Object target) {
        return list.contains(target);
    }
}
